function [residual] = predict(time_line)

[file_name, file_path] = uigetfile('../stats/*', 'Load Test Data');

wrist_data =  csvread(fullfile(file_path, file_name));
time_step = wrist_data(:,1);
weight = wrist_data(:,2);
mu = wrist_data(:,3);
force = wrist_data(:,4:6);
torque = wrist_data(:,7:9);
pos = wrist_data(:,10:12);
quat = wrist_data(:,13:16);

X = [force torque pos quat];
% X = [pos quat];
Y = [weight mu];

X = X(time_line, :);
Y = Y(time_line, :);

[X, Xmu, Xsigma] = zscore(X);
[Y, Ymu, Ysigma] = zscore(Y);


BETA = csvread(fullfile(file_path, '..', 'plsr', [num2str(time_line) '.csv']))
Y_hat = [ones(size(X,1),1) X] * BETA;
residual = Y - Y_hat;

stem(residual)
xlabel('Observation');
ylabel('Residual');

end

